<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //flat 平
        //将多维数组转化为低位数组
        // const arr = [1, 2, 3, 4, 5, 6, [7, 8, 9]];
        // console.log(arr.flat());

        const arr = [1, 2, 3, 4, 5, 6, [7, 8, [9, 10]]];
        //里面可以写参数，是一个数组，参数为深度
        console.log(arr.flat(2));
        const aaarr = [1, 2, 3, [4, 5, 6, 7, [8, 9, 10, [11, 23], 234]]];
        console.log(aaarr.flat(5));

        //flatMap
        const newarr = [2, 4, 6, 8];
        const res = newarr.flatMap(item => [item * 10]);
        console.log(res);




    </script>



</body>

</html>